<!--
 @Author: libing/makeup1122
 @Email: makeup1123@163.com
 @Date: "2020-03-06 22:52:38"
-->
<template>
  <v-container>
    <v-tabs v-model="tabIndex">
      <v-tab>接口基础</v-tab>
    </v-tabs>
    <v-tabs-items v-model="tabIndex">
      <v-tab-item>
        <v-card class="my-3">
          <v-card-title>清理接口调用次数</v-card-title>
          <v-card-text>此接口官方有每月调用限制<b>(每月10次)</b>，不可随意调用。</v-card-text>
          <v-card-actions>
            <v-btn @click="cleanQuotaHandle">清理</v-btn>
          </v-card-actions>
        </v-card>
        <v-card>
          <v-card-title>获取微信服务器 IP (或IP段)</v-card-title>
          <v-card-text>如果公众号基于安全等考虑，需要获知微信服务器的IP地址列表，以便进行相关限制，可以通过该接口获得微信服务器IP地址列表或者IP网段信息。
            <code>{{ipsList}}</code>
          </v-card-text>
          <v-card-actions>
            <v-btn @click="getValidIpsHandle">获取</v-btn>
          </v-card-actions>
        </v-card>
      </v-tab-item>
    </v-tabs-items>
  </v-container>
</template>
<script>
import * as API from '@/api/admin/wx.js'
export default {
  name: 'WxSettings',
  components: {},
  data: function () {
    return {
      tabIndex: 0,
      ipsList: null
    }
  },
  created: function () {
  },
  computed: {},
  methods: {
    cleanQuotaHandle() {
      API.settingsClearQuota().then(res => {
        this.$toasted.success(res.data)
      })
    },
    getValidIpsHandle() {
      API.settingsGetValidIps().then(res => {
        this.ipsList = res.data
        this.$toasted.success('获取成功！')
      })
    }
  }
}
</script>
<style scoped>
</style>
